package com.stone.daoimpl;
import java.util.List;

import com.stone.dao.IAdminDao;
import com.stone.dao.hibernatebaseimpl.BaseDaoHibernateImpl;
import com.stone.model.Admin;
import com.stone.utils.Page;

public class AdminDao extends BaseDaoHibernateImpl<Admin, Long> implements IAdminDao {
	
	public Admin findByName(String username){
		String sql = "from Admin admin where admin.username=" + username;
		List<Admin> list = findByQueryString(sql);
		if(list.size() == 0){
			return null;
		}else{
			return list.get(0);
		}
	}
	
	public List<Admin> findAllAdministrators() {
		String queryString = "from Admin admin order by admin.username desc";
		return this.findAll();
	}
	
}
